﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace Facebook.Utils
{
    /// <summary>
    /// Class to define extension methods needed
    /// </summary>
    public static class ExtensionsMethods
    {
        /// <summary>
        /// concats the array  of strings 
        /// </summary>
        /// <param name="targetArray">Array to concat</param>
        /// <param name="startIndex">index to start the concatenation </param>
        /// <param name="endIndex">index to end the concatenation </param>
        /// <param name="separator">separator to be used during the concatenation</param>
        /// <returns></returns>
        public static string ConcatToString(this string[] targetArray, int startIndex, int endIndex, char separator)
        {
            StringBuilder result = new StringBuilder();
            for (int i = startIndex; i < endIndex || i < targetArray.Length; ++i)
                result.AppendFormat("{0}{1}", targetArray[i], separator);

            result.Remove(result.Length - 1, 1);

            return result.ToString();
        }

    }


}